package app.runner;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import app.htby.utils.SocketUtils;
import app.socket.client.DisConnClientRunnable;

/**
 * socket连接 并消费数据
 * @author lfy.xys
 * @date 2018年6月1日
 *
 */
@Component
public class ApplicationRunner implements CommandLineRunner {

	private static Logger logger = LoggerFactory.getLogger(ApplicationRunner.class);

	public void run(String... var1) throws Exception {
		logger.info("This will be execute when the project was started!");

		// 使用socket连接 得到kafka的集合 KafkaUtils.topicList
		DisConnClientRunnable r = new DisConnClientRunnable(SocketUtils.WEB_SERVER_IP, SocketUtils.WEB_SERVER_PORT, SocketUtils.DIS_START_STATE.getBytes());
//		DisConnClientRunnableTest r = new DisConnClientRunnableTest(); // 测试，使用此类
		new Thread(r).start();
		
	}
}
